package cn.xi.goods.service.impl;

import cn.xi.goods.dao.SpecMapper;
import cn.xi.goods.service.SpecService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class SpecServiceImpl implements SpecService {

    @Autowired
    private SpecMapper specMapper;
    @Override
    public List<Map> findSpecByBrand(String name) {
        List<Map> specByBrand = specMapper.findSpecByBrand(name);
        for (Map map : specByBrand) {
            String options = (String) map.get("options");
            String[] split = options.split(",");
            map.put("options",split);
        }

        return specByBrand;
    }
}
